# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Johannes Schleifenbaum <johannes [at] js-webcoding [dot] de>

pkgname=testssl.sh
_pkgver=3.0.8
pkgver=${_pkgver/-/.}
pkgrel=2
pkgdesc='Testing TLS/SSL encryption'
url='https://github.com/drwetter/testssl.sh'
arch=('any')
license=('GPL2')
depends=('bash' 'coreutils' 'util-linux' 'openssl' 'bind-tools' 'procps-ng')
makedepends=('perl' 'perl-data-dump' 'perl-json' 'perl-test-base')
source=(https://github.com/drwetter/testssl.sh/archive/v${_pkgver}/${pkgname}-${pkgver}.tar.gz
        set-install-dir.patch)
sha512sums=('4634bc5dc57ad8910ca097b22d86511a26e855fb4dc7bef9550a795cb1f53a959b8472008756b40a670d7433ad56236b5a36fe0c88c15de99fdf586e9919b080'
            '82bb83a5553bdc8d02cb655c76163ac9c86b0fc1cff9c5627cb035eae016c5a8b76a3a9e278de4578779bf63a35548815a53911288872530d65c1100c065f621')
b2sums=('cf463236fb0812c2bc5fd5673d0d2d395fc405697817827ee8c660c96d789601a090b57febd48400e33fd9f28b23d42d432734b176b23a8e8ddf710c9b275485'
        '26f90e385085e0c50bd877b37e85f489177bcef0be90baad096c6f3e95732542e2adcaf2aa03ba75d264607d869ea479b768834ba476e258eea291c452f4f3b9')

prepare() {
  cd ${pkgname}-${_pkgver}
  patch -p0 < "${srcdir}/set-install-dir.patch"
  rm bin/openssl.Linux*
}

check() {
  cd ${pkgname}-${_pkgver}
  # the bundled openssl segfaults in the tests
  # TESTSSL_INSTALL_DIR="$(pwd)" prove -v
}

package() {
  cd ${pkgname}-${_pkgver}
  install -Dm 755 testssl.sh "${pkgdir}/usr/bin/testssl"
  install -Dm 644 etc/* -t "${pkgdir}/usr/share/testssl.sh/etc"
  install -Dm 644 Readme.md doc/testssl.1.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 doc/testssl.1 -t "${pkgdir}/usr/share/man/man1"
}

# vim: ts=2 sw=2 et:
